﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BACKOFFICE
{
    class FedTaxTabelClass
    {
        static double TaxableAmount;

        public static double Bracket1(int WithholdingAllowance, double GossPay)
        {
            double FedtaxDeduction = 0;

            double withholdingallowanceamount = 151.90 * WithholdingAllowance;

            if ((GossPay - withholdingallowanceamount) > 87 && (GossPay - withholdingallowanceamount) < 436)
            {
                TaxableAmount = GossPay - withholdingallowanceamount - 87;
                FedtaxDeduction = TaxableAmount * .10;
            }
            else if ((GossPay - withholdingallowanceamount) > 436 && (GossPay - withholdingallowanceamount) < 1506)
            {
                TaxableAmount = GossPay - withholdingallowanceamount - 436;
                FedtaxDeduction = TaxableAmount * .15 + 34.90;
            }
            else if ((GossPay - withholdingallowanceamount) > 1506 && (GossPay - withholdingallowanceamount) < 3523)
            {
                TaxableAmount = GossPay - withholdingallowanceamount - 1506;
                FedtaxDeduction = TaxableAmount * .25 + 195.40;
            }
            else if ((GossPay - withholdingallowanceamount) > 3523 && (GossPay - withholdingallowanceamount) < 7254)
            {
                TaxableAmount = GossPay - withholdingallowanceamount - 3523;
                FedtaxDeduction = TaxableAmount * .28 + 699.65;
            }
            else if ((GossPay - withholdingallowanceamount) > 7254 && (GossPay - withholdingallowanceamount) < 15667)
            {
                TaxableAmount = GossPay - withholdingallowanceamount - 7254;
                FedtaxDeduction = TaxableAmount * .33 + 1744.33;
            }
            else if ((GossPay - withholdingallowanceamount) > 15667 && (GossPay - withholdingallowanceamount) < 15731)
            {
                TaxableAmount = GossPay - withholdingallowanceamount - 15667;
                FedtaxDeduction = TaxableAmount * .35 + 4520.62;
            }
            else if ((GossPay - withholdingallowanceamount) > 15731)
            {
                TaxableAmount = GossPay - withholdingallowanceamount - 15731;
                FedtaxDeduction = TaxableAmount * .396 + 4543.02;
            }


            TaxableAmount = 0;
            return FedtaxDeduction;
        }

    }
}
